<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Adminjson extends CI_Controller {
  public function __construct() {
    parent::__construct();
		auth_user();
  }

  public function get_subscriber_json() {
    if(is_ajax_req()) {
      $this->load->model('subscriber_model', 'subscribers');
      $data = $this->subscribers->get_subscribers();
      if ($data) {
        echo json_encode($data);
      } else {
        print 'No subscribers';
      }
    }
  }

  public function get_single_subscriber_json() {
    $this->load->model('subscriber_model', 'subscribers');
    $data = $this->subscribers->get_subscribers($this->input->post('id'));
    echo json_encode($data);
  }
}